
#ifndef __KLIB_BIT_H__
#define __KLIB_BIT_H__

#ifdef __cplusplus
extern "C" {
#endif

#define bit_get(v, i)		(((unsigned char *)v)[i/8] & (1 << (i % 8)))
#define bit_set(v, i)		(((unsigned char *)v)[i/8] |= (1 << (i % 8)))
#define bit_clr(v, i)		(((unsigned char *)v)[i/8] ^= (1 << (i % 8)))

void *bit_read(void *value, const void *base, int offset, size_t bitsize);

#ifdef __cplusplus
}
#endif

#endif
